﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<List<CRM.Database.Model.LegalEntities>>" %>
<%@ Import Namespace="CRM.Resourses" %>

<% Html.DevExpress().GridView(settings =>
                                    {
                                        settings.Name = "gdLegalEntities";
                                        settings.KeyFieldName = "IdLegalEntity";
                                        settings.CallbackRouteValues =
                                            new { Controller = "Customers", Action = "LegalEntitiesListPartial" };
                                        settings.SettingsPager.PageSize = 20;

                                        settings.Settings.ShowGroupPanel = true;
                                        settings.Settings.ShowFilterRow = true;
                                        
                                        //settings.StylesFilterControl=

                                        settings.Width = Unit.Percentage(100);

                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.CustomerName;
                                            column.FieldName = "IdCustomer";
                                            // column.
                                            column.ColumnType =
                                                MVCxGridViewColumnType.HyperLink;
                                            column.Settings.FilterMode =
                                                ColumnFilterMode.DisplayText;
                                            column.Settings.AutoFilterCondition =
                                                AutoFilterCondition.Contains;
                                            HyperLinkProperties properties = column.PropertiesEdit as HyperLinkProperties;
                                            String urlFormatString =
                                                 Url.Action("Details", "Customers",
                                                            new RouteValueDictionary(
                                                                new { id = "{0}" }));

                                            properties.NavigateUrlFormatString = HttpUtility.UrlDecode(urlFormatString);
                                            properties.TextField = "Name";

                                        });

                                      

                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.CustomerNumber;
                                            column.FieldName = "SequentialNumber";
                                        });

                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.customerManager;
                                            column.FieldName = "Manager";
                                        });

                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.profineRegion;
                                            column.FieldName = "ProfineRegionNameLocalized";
                                        });

                                        settings.Columns.Add(column =>
                                                                 {
                                                                     column.Caption = Resourses.Cities;
                                                                     column.FieldName = "CitiesStr";
                                                                     column.Settings.AutoFilterCondition =
                                                                         AutoFilterCondition.Contains;
                                                                 });


                                    })
                                        
       .Bind(Model).GetHtml();%>